<div>
<form class="form-horizontal" role="form" name="fileDetailForm" novalidate>
  <div class="form-ctrl md-whiteframe-z1">
    <div class="form-search" style="height:160px;" ng-class="{true: 'shou'}[flag.formIsFold]" ng-switch="fileDetail.timeType.timeTypeCode">
      <div>
        <label style="">业务线</label>
        <md-select ng-model="fileDetail.channelCode">
          <md-select-label>{{fileDetail.channelCode ? _getNames(fileDetail.channelCode,'businessLineName',selector.channelCode) : "全部"}}</md-select-label>
          <md-option ng-value="" ng-click="fileDetail.channelCode = undefined">全部</md-option>
          <md-option ng-value="channelCode"  ng-repeat="channelCode in selector.channelCode">{{channelCode.businessLineName}}</md-option>
        </md-select>
      </div>
      <div>
        <label style="">省公司</label>
        <md-select multiple ng-model="fileDetail.provinceCode">
          <md-select-label>{{fileDetail.provinceCode.length ? _getNames(fileDetail.provinceCode,'provinceName', selector.provinceCode) : "全部"}}</md-select-label>
          <md-option ng-value="" ng-click="_checkAll(fileDetail,'provinceCode')">全部</md-option>
          <md-option ng-value="province" ng-repeat="province in selector.provinceCode">{{province.provinceName}}</md-option>
        </md-select>
      </div>
      <div>
        <label style="">账期</label>
        <md-select ng-model="fileDetail.timeType">
          <md-select-label>{{fileDetail.timeType ? _getNames(fileDetail.timeType,'timeTypeName',selector.timeType) : "日"}}</md-select-label>
          <md-option ng-value="timeType" ng-repeat="timeType in selector.timeType" >{{timeType.timeTypeName}}</md-option>
        </md-select>
      </div>
      <input-quarter-group start-time="fileDetail.quarter.startTime" end-time="fileDetail.quarter.endTime" ng-switch-when="4"></input-quarter-group>

      <div ng-if="!fileDetail.timeType || fileDetail.timeType.timeTypeCode !== '4'">
        <md-input-container flex>
          <label >开始时间</label>
          <input name="dateStartTime" time-validate="day" type="date" end-time="date.endTime" ng-model="date.startTime"  ng-switch-default required>
          <div ng-messages="fileDetailForm.dateStartTime.$error">
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="time-error">开始时间不应大于结束时间</div>
          </div>
          <input name="monthStartTime" time-validate="month" ng-model="date.startTime"  end-time="date.endTime" type="month" ng-switch-when="3" required>
          <div ng-messages="fileDetailForm.monthStartTime.$error">
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="time-error">开始时间不应大于结束时间</div>
          </div>
          <input ng-model="date.startTime"  time-validate="year" end-time="date.endTime" type="number" ng-switch-when="5" name="startQuarter" required>
          <div ng-messages="fileDetailForm.startQuarter.$error">
            <div ng-message="required">请正确输入时间</div>
            <div ng-message="time-error">开始时间不应大于结束时间</div>
          </div>
        </md-input-container>
        </div>
        <div ng-if="!fileDetail.timeType || fileDetail.timeType.timeTypeCode !== '4'">
          <md-input-container flex>
            <label>结束时间</label>
            <input name="dateEndTime" time-validate="day" type="date" ng-model="date.endTime"  start-time="date.startTime" ng-switch-default required>
            <div ng-messages="fileDetailForm.dateEndTime.$error">
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">结束时间不应小于开始时间</div>
              <div ng-message="too-great">结束时间不应大于当前时间</div>
            </div>
            <input name="monthEndTime" time-validate="month" ng-model="date.endTime"  type="month" start-time="date.startTime" ng-switch-when="3" required>
            <div ng-messages="fileDetailForm.monthEndTime.$error">
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">结束时间不应小于开始时间</div>
              <div ng-message="too-great">结束时间不应大于当前时间</div>
            </div>
            <input ng-model="date.endTime"  time-validate="year" start-time="date.startTime" type="number" ng-switch-when="5" name="endQuarter" required>
              <div ng-messages="fileDetailForm.endQuarter.$error">
              <div ng-message="required">请正确输入时间</div>
              <div ng-message="time-error">结束时间不应小于开始时间</div>
              <div ng-message="too-great">结束时间不应大于当前时间</div>
            </div>
          </md-input-container >
        </div>
      </div>
    <i class="glyphicon glyphicon-chevron-up shrinkage" ng-click="flag.formIsFold=true" ng-show="flag.showTable && !(fileDetailForm.$invalid||quarterInvalid)"></i>
    <md-button ng-click="getFileDetail()" ng-disabled="fileDetailForm.$invalid||quarterInvalid" class="md-fab md-primary md-hue-1" aria-label="Profile">
      <i class="glyphicon glyphicon-search"  ng-show="!flag.formIsFold"></i>
      <i class="glyphicon glyphicon-arrow-down" style="margin-top:28px;" ng-show="flag.formIsFold"></i>
    </md-button>
  </div>
</form>
<div class="table-info" ng-controller="fileStatViewCtrl">
  <div>
    <div class="menus" >
      <!-- <md-button  ng-show="showDetail" aria-label="decede" class="md-raised" ng-click="showDetail =false">
        返回
      </md-button> -->
      <md-button aria-label="列表" class="md-raised ico-btn" ng-click="flag.showTable=true">
        <img src="images/tables.png">
      </md-button>
      <md-button aria-label="图表" class="md-raised ico-btn" ng-click="flag.showTable=false">
        <img src="images/charts.png">
      </md-button>
      <form action="{{exportUrl}}"  target="_black"  method="post" style="display: initial;" ng-show=" viewObj.isPrepare === true">
        <input type='hidden' name="data"  value='{{viewObj.exportParam}}'>
        <md-button  type="submit"  class="md-raised">导出Excel</md-button>
      </form>
    </div>
    <div class="table-detail" ng-show="flag.showTable === true">
      <div class="t_r" >
        <table class="table table-bordered">
          <caption style="text-align:center;font-size:large;font-weight:bold;color:black">{{viewObj.title}}</caption>
          <thead>
            <tr>
              <th width="260px;">账期</th>
              <th width="25%">省代码</th>
              <th width="25%">省公司</th>
              <th width="25%">未按时到达次数</th>
              <th width="25%">延迟时间(小时)</th>
              <!-- <th width="25%">&nbsp;</th> -->
            </tr>
          </thead>
          <tbody>
            <tr ng-repeat="item in viewObj.series">
              <td>{{viewObj.duration}}</td>
              <td>{{item.provinceCode}}</td>
              <td>{{item.provinceName}}</td>
              <td>{{item.unreceivedCount}}</td>
              <td>{{item.delayedTime}}<td>
              <!-- <td><a href="javascript:;" ng-click="getMoreDetail(item.provinceCode)">详细情况</a></td> -->
            </tr>
            <tr class="summary" >
              <td>汇总</td>
              <td></td>
              <td></td>
              <td>{{viewObj.total.unreceivedCount}}</td>
              <td>{{viewObj.total.delayedTime}}</td>
            </tr>
          </tbody>
        </table>
      </div>
      <!-- <div class="t_r" style="padding: 30px 0px;" ng-show="showDetail" ng-controller="fileDetailViewCtrl">
      <div class="t_r" ng-show="showDetail" ng-controller="fileDetailViewCtrl">
        <table class="table table-bordered">
          <thead>
            <tr>
              <th width="15%">日期</th>
              <th width="17%">延误时间长度(h)</th>
              <th width="17%">校验失败(数量)</th>
              <th width="17%">空文件(数量)</th>
              <th width="17%">漏传记录(数量)</th>
              <th width="17%">文件重发次数</th>
            </tr>
          </thead>
          <tbody>
            <tr ng-repeat="item in details">
              <td width="15%">{{item.time}}</td>
              <td width="17%">{{item.delayedTime}}</td>
              <td width="17%">{{item.checkFailCount}}</td>
              <td width="17%">{{item.emptyFileCount}}</td>
              <td width="17%">{{item.missedSendCount}}</td>
              <td width="17%">{{item.fileResendCount}}</td>
            </tr>
          </tbody>
        </table>
        <div ng-show="showDetail">
          <ds-page
                  total-count=totalCount
                  page-size=param.page.pageSize
                  page-itmes=pageItmes
                  param=param
                  current-page=param.page.currentPage
                  go-page="turnToPage(param)"
                  page-size-change="pageSizeChange(param.page.pageSize)"
                  show-max-page="5"
                  first-text="<<"
                  last-text=">>"
                  previous-text="<"
                  next-text=">"
                  >
          </ds-page>
        </div>
      </div> -->
    </div>
    <div ng-show="flag.showTable === false">
      <div id="fileDetailChart" style="height:375px" ></div>
    </div>
  </div>
</div>
</div>